<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>  
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="overflow-y: visible;">
    <jsp:include page="../../../include/IncludeMain.jsp"></jsp:include>
  	<body style="overflow-y: visible;" onload="changeRowColor();">
    	<table class="mainTable">
		<thead>
			<tr class="tableController">
				<th colspan="10">
					<h3>物料列表</h3>
					<div class="tableControllerButton">
						<a class="button" href="javascript:void(0)" onclick="this.blur(); window.location='${pageContext.request.contextPath }/pages/business/material.do?act=get'; return false;"><span><img src="${pageContext.request.contextPath }/js/kui/icons/application_add.png" align="absmiddle"/>&nbsp;添加</span></a>
						&nbsp;&nbsp;
					</div>
				</th>
			</tr>
			<tr class="tableTitle">
				<th>
					<h3>料号</h3>
				</th>
				<th>
					<h3>品名</h3>
				</th>
				<th>
					<h3>描述</h3>
				</th>
				<th>
					<h3>类型</h3>
				</th>
				<th>
					<h3>库存</h3>
				</th>
				<th>
					<h3>单位</h3>
				</th>
				<th>
					<h3>备注</h3>
				</th>
				<th>
					<h3>操作</h3>
				</th>                         
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${pager.data}" var="material">
			<tr>
				<td>${material.material_id}</td>
				<td>${material.name}</td>
				<td>
					<c:choose>
						<c:when test="${fn:length(material.description) > 30}">
							<c:out value="${fn:substring(material.description, 0, 30)}..."></c:out>
						</c:when>
						<c:otherwise>
							<c:out value="${material.description}"></c:out>
						</c:otherwise>
					</c:choose>
				</td>
				<td>
					<c:forEach items="${typeList}" var="data">
						<c:if test="${material.type == data.id}">${data.type_name }</c:if>
					</c:forEach>
				</td>
				<td>${material.repertory}</td>
				<td>${material.unit}</td>
				<td>
					<c:choose>
						<c:when test="${fn:length(material.comments) > 30}">
							<c:out value="${fn:substring(material.comments, 0, 30)}..."></c:out>
						</c:when>
						<c:otherwise>
							<c:out value="${material.comments}"></c:out>
						</c:otherwise>
					</c:choose>&nbsp;
				</td>
				<td>
					<a class="button-small" href="javascript:void(0)" onclick="this.blur(); window.location='${pageContext.request.contextPath }/pages/business/material.do?act=get&material.id=${material.id }'; return false;"><span>修改</span></a>
				</td>
			</tr>
			</c:forEach>
		</tbody>
		<tfoot>
			<tr  class="tableController_bottom">
				<td colspan="11" align="center">
					<jsp:include page="../../../include/SplitPage.jsp">
						<jsp:param name="pager" value="${action.pager}"/>
					</jsp:include>
				</td>
			</tr>
		</tfoot>
	</table>
	
  </body>
</html>
